Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(port): Implement GLOBALLY_UNIQUE #5723

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Zlorthishen
Copy link
Contributor

@Zlorthishen Zlorthishen commented Nov 16, 2024

Checklist

Required

Optional

  • This PR ports commits from DDA or other cataclysm forks.
    • I have attributed original authors in the commit messages adding Co-Authored-By in the commit message.
    • I have linked the URL of original PR(s) in the description.
  • This is a C++ PR that modifies JSON loading or behavior.
    • I have documented the changes in the appropriate location in the doc/ folder.
    • If documentation for this feature does not exist, please write it or at least note its lack in PR description.

-->

Purpose of change

ports dda change

Describe the solution

implements GLOBALLY_UNIQUE flag that makes overmap specials exist only once.

Describe alternatives you've considered

Testing

Made multiple characters spawn at the aircraft carrier and military base, all characters spawned at the same locations in the world. Also made those characters get the "Go to the Evac Center" mission, and it directed the characters to the same evac center.

Additional context

Co-Authored-By: anothersimulacrum <[email protected]>
@github-actions github-actions bot added src changes related to source code. JSON related to game datas in JSON format. labels Nov 16, 2024
Copy link
Contributor

autofix-ci bot commented Nov 16, 2024

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@Zlorthishen Zlorthishen marked this pull request as ready for review November 16, 2024 02:46
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i get evac center needing to be unique because of unique npcs it spawns, but may i ask why military bases and aircraft carrier need be globally unique?

@RoyalFox2140
Copy link
Collaborator

i get evac center needing to be unique n because of unique npcs it spawns, but may i ask why military bases and aircraft carrier need be globally unique?

Generally speaking I'm ok with adding more specific military locations and tying them into quests than just having a single generic military base.

If we want to go with players being able to access military loot sustainably we can add national guard armories and an airbase, plus garrisons.

The carrier is a bit of a weird one as finding several carriers in lakes would be more of a stretch than finding one.

@Zlorthishen
Copy link
Contributor Author

Zlorthishen commented Nov 16, 2024

i get evac center needing to be unique because of unique npcs it spawns, but may i ask why military bases and aircraft carrier need be globally unique?

those were just from the original dda pr, but there are probably a few other locations that could be Globally Unique

  • Tacoma Ranch
  • Isherwood Farm
  • The Necropolis

edit: I removed the flag from the military base, because it isn't unique enough to be a one-off location

scarf005
scarf005 previously approved these changes Nov 17, 2024
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

LGTM

Copy link
Member

@chaosvolt chaosvolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Compiled and load-tested.
  2. Spawned in the aircraft carrier scenario twice, second time it fails to find a starting location:
    image

This is on default world settings and is exactly why we haven't ported this PR in all this time.

@chaosvolt
Copy link
Member

chaosvolt commented Nov 17, 2024

Testing in build 2024-11-14:

  1. Success
  2. Success
  3. Success
  4. Success
  5. Success
  6. Success
  7. Success
  8. Success
  9. Success
  10. Success

Testing in compiled PR:

  1. Success
  2. Failure
  3. CRASHES
  4. Success
  5. Success
  6. Success
  7. Success
  8. Success
  9. Success
  10. Success

Both tests done with default world settings. Only having it fail to generate once is arguably not fatal to this PR since the sample size is low enough and the carrier scenario is suspected to do this occasionally even without this PR, but the crash is definitely concerning.
image

@chaosvolt
Copy link
Member

I've yet to get it to crash again to try and grab more info, but I did just get four failures to generate in a row.

@chaosvolt chaosvolt dismissed scarf005’s stale review November 17, 2024 17:22

It's being wacky and Kheir said in the discord it has lots of unndeeded code that needs to be stripped out, so this approval was definitely premature

if( special.has_flag( "UNIQUE" ) ) {
if( unique || globally_unique ) {
const overmap_special_id &id = iter.special_details->id;
const overmap_special_placement_constraints &constraints = iter.special_details->get_constraints();
Copy link
Collaborator

@KheirFerrum KheirFerrum Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do these variables come into play? Remove, or incorporate them into the code. Check the Files Changed tab to check for these variables (I count at least 4).

It shouldn't really even have passed tests with unused variables. Did we disable that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't really even have passed tests with unused variables. Did we disable that?

lint for unused variables exists but it only emits warning because it often crashed on unrelated existing issues

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

speaking of "unrelated", should make it error again since #5548 is merged and there probably won't be unrelated changes anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON related to game datas in JSON format. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants